package com.itlong.cloud.resource;

import com.itlong.cloud.POJO.PO.TimeTaskParkingErrorOrderPO;
import com.itlong.cloud.common.property.ITimeTaskParkingErrorOrderServiceClient;
import com.itlong.cloud.service.ITimeTaskParkingErrorOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      停车场业务指令结果信息业务处理暴露接口实现类
 * </desc>
 */
@RestController
public class TimeTaskParkingErrorOrderServiceResource implements ITimeTaskParkingErrorOrderServiceClient {
    @Autowired
    ITimeTaskParkingErrorOrderService iTimeTaskParkingErrorOrderService;

    /**
     * <desc>
     *      添加执行结果
     * </desc>
     *
     * @param po
     * @return
     * @author Jiaqi.X
     * @createDate 2018/11/15
     */
    @PostMapping(path = "/property/parking/common/save")
    @Override
    public Integer save(@RequestBody TimeTaskParkingErrorOrderPO po) throws Exception {
        return iTimeTaskParkingErrorOrderService.save(po);
    }

    /**
     * <desc>
     *      获取执行失败的指令
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2018/11/15
     */
    @PostMapping(path = "/property/parking/common/getUntreatedErrors")
    @Override
    public List<TimeTaskParkingErrorOrderPO> getUntreatedErrors() {
        return iTimeTaskParkingErrorOrderService.getUntreatedErrors();
    }

    /**
     * <desc>
     *      将处理状态改为已处理
     * </desc>
     *
     * @param errorIds
     * @return
     * @author Jiaqi.X
     * @create 2018/11/15
     */
    @PostMapping(path = "/property/parking/common/setDataStatusSuccess")
    @Override
    public Integer setDataStatusSuccess(String errorIds) {
        return iTimeTaskParkingErrorOrderService.setDataStatusSuccess(errorIds);
    }
}
